package com.ywjt.pinkelephant.assistant.fragment;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.ywjt.pinkelephant.R;
import com.ywjt.pinkelephant.assistant.adapter.AssistantBottomAdapter;
import com.ywjt.pinkelephant.base.BaseVPFragment;
import com.ywjt.pinkelephant.widget.ViewPagerForScrollView;


import java.util.ArrayList;
import java.util.List;

public class AssistantFragment extends BaseVPFragment {
    private AssistantBottomAdapter adapter;
    private RecyclerView rcView;
    private View view;
    private Context context;
    private List<String> data;
    private ViewPagerForScrollView pager;
    private int position=0;

    public AssistantFragment(Context context, ViewPagerForScrollView pager ,Integer position) {
        this.context = context;
        this.pager = pager;
        this.position=position;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (view == null) {
            view = inflater.inflate(R.layout.fragment_assistant, container, false);
            pager.setObjectForPosition(view,position);
            context = getActivity();
            initView();
        }
        return view;
    }


    @Override
    public void onHiddenChanged(boolean hidden) {
        super.onHiddenChanged(hidden);

    }

    @Override
    protected void onFragmentVisibleChange(boolean isVisible) {
    }

    @Override
    protected void onFragmentFirstVisible() {
    }

    public void initView(){
        rcView=view.findViewById(R.id.rcView);
        data=new ArrayList<>();
        data.add("");
        data.add("");
        data.add("");
        data.add("");
        data.add("");
        data.add("");
        data.add("");
        data.add("");
        adapter=new AssistantBottomAdapter(data);
        rcView.setLayoutManager(new GridLayoutManager(context,2)  );
        rcView.setAdapter(adapter);
    }

}
